package org.hawk.gwt.ppc.parser;

import java.util.List;

/**
 * Represents token(s) interpretation. Different tokens and token groups may be interpreted in different way.
 * This is base interface for such an interpretations.
 * 
 * @author alex.bereznevatiy@gmail.com
 */
public interface Descriptor {

	/**
	 * @return unmodifiable list of tokens associated with this descriptor.
	 * Never returns <code>null</code> or zero-size list.
	 */
	List<Token> getTokens();
	
	/**
	 * Parses input {@link CharSequence} on the tokens and replaces this descriptor with other one.
	 * This descriptor becomes invalid after such operations. New ones returned should be used instead. 
	 * @param replacement
	 * @return list new descriptor of parsed char sequence or empty list in case input is empty.
	 * Returned list is unmodifiable.
	 */
	List<Descriptor> replace(CharSequence replacement);
}
